package com.ge.examplespringbootconsumer;

import com.ge.example.common.model.User;
import com.ge.example.common.service.UserService;
import com.ge.rpcspringbootstarter.annotation.RpcReference;
import org.springframework.stereotype.Service;

/**
 * 需要使用远程调用的服务
 */
@Service
public class ExampleServiceImpl {

    /**
     * 通过 @RpcReference 注解，在初始化时，注入动态代理对象
     */
    @RpcReference
    private UserService userService;

    public void test() {
        User user = new User();
        user.setName("test");
        User resultUser = userService.getUser(user);
        System.out.println(resultUser.getName());
    }
}
